/*
 * DrawPane.h
 *
 *  Created on: 09.06.2011
 *      Author: sili
 */

#ifndef DRAWPANE_H_
#define DRAWPANE_H_

#include <vdr/osd.h>
#include <vdr/plugin.h>
#include <math.h>

#include <Magick++.h>
#include "utf8.h"
#include "UriCodec.h"
//#include "AALItem.h"

#include "Tools.h"

using namespace std;
using namespace Magick;

class AALItem;
class Visualizer;

class DrawPane{
public:
	enum PaneType{contentPaneType, infoPaneType, controlPaneType};
	// It's just a copy from osd.h, so we can use the same values
	enum TextAlignment {
		taCenter  = 0x00,
		taLeft    = 0x01,
		taRight   = 0x02,
		taTop     = 0x04,
		taBottom  = 0x08,
		taDefault = taTop | taLeft
	};

	AALArea area;			// the whole available area
	cPixmap * pixmapPane;
	Image * imagePane;		// magick image pane used for a non true color osd
	uint32_t colorBg;

	// used for the true color osd
	DrawPane(cPixmap * _pixmap, AALArea * _area, uint32_t _colorBg, PaneType _type, const char * _name="");
	// used for the not true color osd
	DrawPane(const int _bpp, AALArea * _area, uint32_t _colorBg, PaneType _type, const char * _name="");
	virtual ~DrawPane();


	virtual void DrawHotkey(AALLocation & _location, AALItem * _aalItem);
	virtual void DrawText(AALArea & _area, const char * _text, tColor _colorFg, tColor _colorBg, const cFont * _font, int _alignment = taDefault);

	// Real drawing ....
	virtual void DrawImage(const cPoint & _point,Image * _image, int _visibility = 100);
	virtual void DrawText(const cPoint & _point, const char * s, tColor _colorFg, tColor _colorBg, const cFont * _font, int _width = 0, int _height = 0, int _alignment = taDefault);

	virtual void Clear();

	virtual bool Intersect(int _x, int _y);

	vector<AALItem *> currentVisibleItems;

private:
	int bpp;
	string name;
	PaneType paneType;
};
#endif /* DRAWPANE_H_ */
